home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic 6.0 Utilities / Multi-Language Add-In for Visual Basic 6.0 / MultiLang.msi / _AF3F81804EF811D5BEBE0020182C1E5C < prev    next >
Encoding:
Text File  |  2001-05-24  |  1.9 KB  |  51 lines

  1. Attribute VB_Name = "MlStringModule"
  2. Option Explicit
  3.  
  4. Public ml_CurrentLanguageId As Long
  5. Public Const ml_LanguageCount As Long = 2
  6.  
  7. Public Function ml_string(ByVal StringID As Long, Optional ByVal Text As String = "") As String
  8.   ml_string = LoadResString(StringID)
  9. End Function
  10.  
  11. Public Function ml_LanguageName(ByVal LangIndex As Long) As String
  12.   Select Case LangIndex
  13.     Case 2057: ml_LanguageName = "English (United Kingdom)"
  14.     Case 1031: ml_LanguageName = "German (Standard)"
  15.     Case Else: ml_LanguageName = "Invalid Language Index"
  16.   End Select
  17. End Function
  18.  
  19. Public Sub ml_ChangeLanguage(ByVal LanguageID As Long, ByVal Language As String)
  20.   
  21.   'If an application uses UserControls or Class Modules compiled as separate
  22.   'projects, then these projects may (a) not support the same languages or
  23.   '(b) not use the same ID number for a given language.
  24.   'If the language is changed at run time, an event can be fired via the
  25.   'MLSupport object, and received in all projects.
  26.   'This function checks whether the ID and Language name match before accepting
  27.   'the language change. If they do not match, then it searches for language
  28.   'using the language name not the ID. If the language is not found, then the
  29.   'language is not changed.
  30.   
  31.   'Check whether the LanguageID and the Language match in this project.
  32.   'Use StrComp() for case insensitive comparison
  33.   If StrComp(ml_LanguageName(LanguageID), Language, vbTextCompare) = 0 Then
  34.     ml_CurrentLanguageId = LanguageID
  35.   Else
  36.     'LanguageID may be different in this project.
  37.     'Search for the language string.
  38.     For LanguageID = 0 To ml_LanguageCount - 1
  39.       If StrComp(ml_LanguageName(LanguageID), Language, vbTextCompare) = 0 Then
  40.         ml_CurrentLanguageId = LanguageID
  41.         Exit For
  42.       End If
  43.     Next
  44.   End If
  45.   
  46. End Sub
  47.  
  48. Public Function ml_LanguageIds() As Variant
  49.   ml_LanguageIds = Array(2057, 1031)
  50. End Function
  51.